/**
 *
 */
Ext.define('vacake.view.AreaSelect', {
    extend: 'Ext.List',
    xtype: 'areaSelectView',
    requires: ['Ext.List'],
    config: {
        store: 'AreaSelect',
        itemTpl: '<div style="line-height: 47px;">' 
                + '<span class="color2">{name}</span>' 
                + '<span style="float: right;" class="color2">工作时间：{starttime}点 - {endtime} 点</span>' 
                + '</div>',
        emptyText: '<div style="width: 100%; height: 100%; text-align: center; vertical-align: middle">' +
            '<img width="94" height="94" src="resources/images/null.png"  style="margin-top:100px;"  /> ' +
            '<div class="height30 color2 font2">地区列表无法取得数据</div>' +
            '</div>',
        items: [{
                docked: 'top',
                xtype: 'titlebar',
                action: 'titleBar',
                title: '选择地区',
                items: [{
                        text: '返回',
                        id: 'back_home',
                        ui: 'action-back',
                        hidden: true
                    }
                ]
            }
        ],
        listeners: {
            initialize: function() {
                Ext.Viewport.mask({
                    xtype: 'loadmask',
                    message: '加载数据中...'
                });
                var areaSelect = Ext.getStore('AreaSelect');
                if (areaSelect.getAllCount() <= 0) {
                    areaSelect.load();
                }

            },
            painted: function() {
                var districtId = window.localStorage.getItem('app_district_id');
                if (districtId != null) {
                    Ext.getCmp('back_home').setHidden(false);
                }
                Ext.Viewport.unmask();
            },
            back: function() {
                Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
            }
        }
    }

});